21. Installing OpenCV, Instructions

OpenCV

Before we jump into coding our green screen example, you may want to follow along by downloading a library, which we’ll use throughout this course: OpenCV!

Installing OpenCV is completely optional for this course, since you can complete your work in provided notebooks.

OpenCV is a computer vision and machine learning software library that includes many common image analysis algorithms that will help us build custom, intelligent computer vision applications. To start with, this includes tools that help us process images and select areas of interest! The library is widely used in academic and industrial applications; from their site, OpenCV includes an impressive list of users: “Along with well-established companies like Google, Yahoo, Microsoft, Intel, IBM, Sony, Honda, Toyota that employ the library, there are many startups such as Applied Minds, VideoSurf, and Zeitera, that make extensive use of OpenCV.”

And we’ll be getting a lot of experience with this library as we progress!

Installation via Terminal

I will be using a Jupyter notebook to walk through code examples and I’ll assume you’ll be working in the same environment.

To install OpenCV for use in a notebook, open a terminal window (aka a command prompt window for Windows users) and use conda to install the latest version (v3) using the following command:

conda install opencv3

You should then get an installation prompt asking to proceed (y/n)? Select yes to proceed with the installation.

Troubleshooting Note: If the above installation command did not work for your computer, try accessing opencv3 through a specific source and use one of the the following commands:

conda install -c conda-forge opencv=3.2.0

or

conda install -c menpo opencv3=3.2.0

Screenshot of installation command in my (Cezanne's) terminal window.

Screenshot of installation command in my (Cezanne's) terminal window.

Verify Installation

And that’s it! To verify that you have OpenCV correctly installed, let’s check in a python environment. Again in your terminal window, type the following:

First, let’s get into our python execution environment by typing python

Then, let’s see if we have OpenCV installed by typing import cv2. if this command executes without any errors, you’ve installed it correctly!

Finally, to check your version of OpenCV, type a print statement print (cv2.__version__) which should print out the latest stable version.

Now you're ready to code in your own environment!

Let's get back to the green screen example :)